home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.input;
-
- import sub_arctic.lib.interactor;
- import java.awt.Point;
-
- /**
- * This interface provides the input protocol for objects which are dragged
- * and may be snapped to objects which implement the snap_targetable
- * interface. (This is a subclass of move_draggable.) These "drag" objects
- * are moved over the top of snap "target" objects. Where the right
- * conditions occur, feedback is produced which snaps the objects together in
- * some way (typically by pulling the drag object to the target object).
- * The snap is said to occur "from" drag (snap_draggable) objects "to" target
- * (snap_targetable) objects. Both this protocol and the snap_targetable
- * protocol are managed and delivered by the snap_drag_agent.<p>
- *
- * Snapping requires a two part test. The first part is geometric. In this
- * part we determine if a feature point of the drag object is close enough
- * geometrically to snap to the target. If this test passes, then a second
- * semantic test is performed to determine if the two objects are semantically
- * compatible (this second test by snap_targetable.snap_from_ok() may involve
- * type tests and/or exchange of information between the target object and this
- * object using the protocol of an application specific interface defined
- * elsewhere). If both snapping tests succeed, and the snap is the closest
- * candidate snap, the snap will occur.<p>
- *
- * If their are no suitable snaps, but some snaps pass the geometric test
- * (i.e., are close enough) then "anti-snaps" will be considered. An
- * anti-snap is designed to provide feedback about a negative condition --
- * it is typically used to produce a kind of dynamic "error message" that
- * indicates why a geometrically possible snap is not semantically suitable.
- * Anti-snaps must pass a second semantic test (performed by
- * snap_targetable.anti_snap_from_ok()) before they are activated.<p>
- *
- * @see sub_arctic.input.move_draggable
- * @see sub_arctic.input.snap_targetable
- * @see sub_arctic.input.snap_drag_agent
- * @author Scott Hudson
- */
- public interface snap_draggable extends move_draggable {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Indicate that the object should snap to a given target object.
- *
- * @param event evt the event "causing" the snap.
- * @param Point orig_pt where this object would be without
- * the snap.
- * @param Point snap_pt where this object is with the snap.
- * @param int feature_pt_indx the feature point of this object
- * that we are snapping with.
- * @param snap_targetable target_obj the target object we are snapping
- * to.
- * @param Object user_info the user info for this input.
- * @return boolean indicating if the input has been consumed.
- */
- public boolean snap_to(
- event evt,
- Point orig_pt,
- Point snap_pt,
- int feature_pt_indx,
- snap_targetable target_obj,
- Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Perform feedback while a snap is active.
- *
- * @param event evt the event "causing" the snap.
- * @param Point orig_pt where this object would be without
- * the snap.
- * @param Point snap_pt where this object is with the snap.
- * @param int feature_pt_indx the feature point of this object
- * that we are snapping with.
- * @param snap_targetable target_obj the target object we are snapping
- * to.
- * @param Object user_info the user info for this input.
- * @return boolean indicating if the input has been consumed.
- */
- public boolean snap_feedback(
- event evt,
- Point orig_pt,
- Point snap_pt,
- int feature_pt_indx,
- snap_targetable target_obj,
- Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Indicate that the object is no longer snapped to a given target object.
- *
- * @param event evt the event "causing" the unsnap.
- * @param Point orig_pt where this object should be without
- * the snap.
- * @param Point snap_pt where this object was with the snap.
- * @param int feature_pt_indx the feature point of this object
- * that we were snapping with.
- * @param snap_targetable target_obj the target object we were snapping
- * to.
- * @param Object user_info the user info for this input.
- * @return boolean indicating if the input has been consumed.
- */
- public boolean unsnap_to(
- event evt,
- Point orig_pt,
- Point snap_pt,
- int feature_pt_indx,
- snap_targetable target_obj,
- Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Indicate that the object should anti-snap to a given target object.
- *
- * @param event evt the event "causing" the anti-snap.
- * @param Point orig_pt where this object would be without
- * the anti-snap.
- * @param Point snap_pt where this object is with the
- * anti-snap.
- * @param int feature_pt_indx the feature point of this object
- * that we are anti-snapping with.
- * @param snap_targetable target_obj the target object we are
- * anti-snapping to.
- * @param Object user_info the user info for this input.
- * @return boolean indicating if the input has been consumed.
- */
- public boolean anti_snap_to(
- event evt,
- Point orig_pt,
- Point snap_pt,
- int feature_pt_indx,
- snap_targetable target_obj,
- Object anti_snap_info,
- Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Perform feedback while an anti-snap is active.
- *
- * @param event evt the event "causing" the anti-snap.
- * @param Point orig_pt where this object would be without
- * the anti-snap.
- * @param Point snap_pt where this object is with the
- * anti-snap.
- * @param int feature_pt_indx the feature point of this object
- * that we are anti-snapping with.
- * @param snap_targetable target_obj the target object we are
- * anti-snapping to.
- * @param Object user_info the user info for this input.
- * @return boolean indicating if the input has been consumed.
- */
- public boolean anti_snap_feedback(
- event evt,
- Point orig_pt,
- Point snap_pt,
- int feature_pt_indx,
- snap_targetable target_obj,
- Object anti_snap_info,
- Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Indicate that the object is no longer anti-snapped to a given target
- * object.
- *
- * @param event evt the event "causing" the unanti-snap.
- * @param Point orig_pt where this object should be without
- * the anti-snap.
- * @param Point snap_pt where this object was with the
- * anti-snap.
- * @param int feature_pt_indx the feature point of this object
- * that we were anti-snapping with.
- * @param snap_targetable target_obj the target object we were
- * anti-snapping to.
- * @param Object user_info the user info for this input.
- * @return boolean indicating if the input has been consumed.
- */
- public boolean unanti_snap_to(
- event evt,
- Point orig_pt,
- Point snap_pt,
- int feature_pt_indx,
- snap_targetable target_obj,
- Object anti_snap_info,
- Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-